package com.zyz.C_数组.练习;

/**
 * @author: vick
 * @Date: 2025/3/13
 * @Description:
 * @version: 1.0
 */
public class Demo2 {
    public static void main(String[] args) {
        int[] nums = {10, 20, 5, 40, 15};
        //假设最大值是第一个元素
        int max = nums[0];

        for (int num : nums) {
            if (num > max) {
                max = num; // 更新
            }
        }

        System.out.println("数组种最大值为：" + max);
    }
}
